# default to compiling with debug information
CCOPTS ?= -g --symdebug:dwarf --optimize_with_debug -qq -pdsw225 

# required C preprocessor flags
CPPFLAGS = -D__MSP430G2553__ -I C:/dev/ti/ccsv5/tools/compiler/msp430_4.1.1/include -I "C:/dev/ti/grace_1_10_04_36/packages"  -I "C:/dev/ti/grace_1_10_04_36/packages/ti/mcu/msp430//include"

# the compiler and archiver commands
CC = C:/dev/ti/ccsv5/tools/compiler/msp430_4.1.1/bin/cl430 --abi=eabi -c --obj_directory=objs/  -vmsp
AR = C:/dev/ti/ccsv5/tools/compiler/msp430_4.1.1/bin/ar430 rq
RM = cmd.exe /q /c del /f
MKDIR = mkdir

# create object sub-directory, if necessary
ifeq (,$(wildcard objs/))
    $(shell $(MKDIR) objs\)
endif

all: csl.lib

objs\CSL_init.obj: CSL_init.c makefile
	@echo cle430 $< ...
	$(CC) $(CCOPTS) $(CPPFLAGS) $<

objs\GPIO_init.obj: GPIO_init.c makefile
	@echo cle430 $< ...
	$(CC) $(CCOPTS) $(CPPFLAGS) $<

objs\BCSplus_init.obj: BCSplus_init.c makefile
	@echo cle430 $< ...
	$(CC) $(CCOPTS) $(CPPFLAGS) $<

objs\Timer0_A3_init.obj: Timer0_A3_init.c makefile
	@echo cle430 $< ...
	$(CC) $(CCOPTS) $(CPPFLAGS) $<

objs\System_init.obj: System_init.c makefile
	@echo cle430 $< ...
	$(CC) $(CCOPTS) $(CPPFLAGS) $<

objs\WDTplus_init.obj: WDTplus_init.c makefile
	@echo cle430 $< ...
	$(CC) $(CCOPTS) $(CPPFLAGS) $<

csl.lib: objs\CSL_init.obj objs\GPIO_init.obj objs\BCSplus_init.obj objs\Timer0_A3_init.obj objs\System_init.obj objs\WDTplus_init.obj
	@ echo are430 $@ $< ...
	$(AR) $@ $^

clean:
	-@$(RM) csl.lib
	-@$(RM) objs\CSL_init.obj
	-@$(RM) objs\GPIO_init.obj
	-@$(RM) objs\BCSplus_init.obj
	-@$(RM) objs\Timer0_A3_init.obj
	-@$(RM) objs\System_init.obj
	-@$(RM) objs\WDTplus_init.obj



